﻿package FP 
{
	import flash.display.Sprite;
	import flash.text.TextField;
	
	/**
	 * ...
	 * @author Ty Kimmey
	 */
	
	 public class HUD extends Sprite 
	{
		// holder variables for TextFields on HUD's timeline
		public var score_txt:TextField;
		public var lives_txt:TextField;
		public var message_txt:TextField;
		
		// private variables for score and lives
		private var score:int = 0;
		public var lives:int = 5;
		// accessor for lives
		//public function get Lives():int { return lives; }
		
		public function HUD(xml:XML) 
		{
			super();
			lives = xml.startLives;
			addPoints(0);
			takeLives(0);
		}
		
		public function addPoints(amount:int):void
		{
			// add to our internal representation of score
			score += amount;
			// and update the visual feedback
			score_txt.text = "Score: "+score;
		}
		
		public function takeLives(amount:int):void
		{
			// subtract from our internal representation of lives
			lives -= amount;
			// and update the visual feedback
			lives_txt.text = "Lives: "+lives;
		}
		
	}

}